package cn.com.huzo.repository.trade.impl;

import cn.com.huzo.model.entities.trade.ShippingOrderLinesDoEntity;
import huzofw.repository.impl.GenericRepositoryImpl;
import huzofw.repository.impl.MyBatisDaoUtils;
import java.util.List;
import org.springframework.stereotype.Repository;
import cn.com.huzo.repository.trade.ShippingOrderLinesDoRepository;
import java.util.Map;

/**
 * 发货发令单明细-引入发货发令单数据访问类实现。
 *
 * @author 吴旭
 */
@Repository("ShippingOrderLinesDoRepository")
public class ShippingOrderLinesDoRepositoryImpl extends GenericRepositoryImpl<ShippingOrderLinesDoEntity, String>
        implements ShippingOrderLinesDoRepository {

    private final String namespace = "cn.com.huzo.repository.trade.ShippingOrderLinesDoRepository";

    /**
     * 构造函数,设置the entity to DeliveryOrderHeaderRepositoryImpl.class.
     */
    public ShippingOrderLinesDoRepositoryImpl() {
        super(ShippingOrderLinesDoEntity.class);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public List<ShippingOrderLinesDoEntity> fetchByHeaderId(Long headerId) {
        return getSqlSession().selectList(MyBatisDaoUtils.getMapperQueryId(
                namespace, "fetchByHeaderId"), headerId);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public List<Map<String, Object>> fetchSumQuantityByHeaderId(Long headerId) {
        return getSqlSession().selectList(MyBatisDaoUtils.getMapperQueryId(
                namespace, "fetchSumQuantityByHeaderId"), headerId);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer fetchForCount(Map<String, Object> criterion) {
        return getSqlSession().selectOne(MyBatisDaoUtils.getMapperQueryId(
                namespace, "fetchForCount"), criterion);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public List<ShippingOrderLinesDoEntity> fetchForPage(Map<String, Object> criterion) {
        return getSqlSession().selectList(MyBatisDaoUtils.getMapperQueryId(
                namespace, "fetchForPage"), criterion);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer insert(Map<String, Object> criterion) {
        return getSqlSession().insert(MyBatisDaoUtils.getMapperQueryId(
                namespace, "insert"), criterion);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer batchUpdate(List<ShippingOrderLinesDoEntity> itemList) {
        return getSqlSession().insert(MyBatisDaoUtils.getMapperQueryId(
                namespace, "batchUpdate"), itemList);
    }

    /**
     * {@inheritDoc}
     * <p>
     */
    @Override
    public Integer delete(String key) {
        return getSqlSession().delete(MyBatisDaoUtils.getMapperQueryId(
                namespace, "delete"), key);
    }
}
